package com.boss.salary.dao;

import com.boss.framework.dto.PaginationDTO;
import com.boss.salary.entity.AgencyInfo;
import com.boss.salary.entity.AgencyVerify;
import com.boss.salary.entity.SalaryBasedata;
import com.boss.salary.entity.SalaryMonthEnd;
import com.boss.salary.vo.SalaryMonthEndVO;
import com.boss.salary.vo.UnitSalaryReportVO;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

public interface ISalaryMonthEndDao {

    /**
     * 单位工资编报：单条插入工资数据
     * @param data
     * @throws NoSuchMethodException
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    void insertSalaryMonthEndDao(SalaryMonthEnd data) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;

    /**
     * 单位工资编报：单条修改工资数据
     * @param data
     * @throws NoSuchMethodException
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    void updateSalaryMonthEndDao(SalaryMonthEnd data) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;

    /**
     * 获取实发工资总和和机构总人数
     * @param agencyId
     * @param reallySendSalaryName
     * @return
     */
    UnitSalaryReportVO selectReallySendSalarySum(String agencyId, Integer queryThirteen, String reallySendSalaryName, String salaryType);

    /**
     * 获取上报的实发工资总和和机构总人数
     * @param agencyId
     * @param reallySendSalaryName
     * @return
     */
    UnitSalaryReportVO selectSubmitReallySendSalarySum(String agencyId,String isThirteen, Integer queryThirteen, String reallySendSalaryName, String salaryType);

    /**
     * 获取月初实发总和
     * @param agencyId
     * @return
     */
    Double selectSubmitReallySendChangeSum(String agencyId, String reallySendSalaryName);

    /**
     * 查询单位上报金额
     * @return
     */
    String selectSubmitSalarySum(Map<String, Object> queryParam);

    /**
     * 获取指定单位的月结数据
     * @param agencyIds
     * @return
     */
    List<SalaryMonthEnd> getSalaryMonthEndByAgencyIds(String agencyIds,int isThirteen);

    /**
     * 根据人员id修改单位id
     * @param personId
     */
    void updateAgencyIdByPersonId(String personId, String agencyId, String updateTime);


    /**
     * 生成银行数据：查询人员工资明细列表
     * @param paginationDTO
     * @param agencyId
     * @param salaryIds
     * @param salaryMonth
     * @param currentSalaryIdJoinColumnMap
     * @param queryForm
     * @return
     */
    List<Map<String, Object>> selectPersonSalaryInfoPage(PaginationDTO paginationDTO,
                                                         String agencyId,
                                                         List<String> salaryIds,
                                                         String salaryMonth,
                                                         Map<String, String> currentSalaryIdJoinColumnMap,
                                                         Map<String, Object> queryForm);

    /**
     * 生成银行数据：查询人员工资明细数量
     * @param agencyId
     * @param condition
     * @return
     */
    int selectPersonSalaryInfoTotal(String agencyId, Map<String,Object> condition);

    /**
     * 十三月工资：查询十三月工资
     * @param agencyId
     * @param salaryMonth
     * @param salaryColumns
     * @return
     */
    List<Map<String, Object>> selectThirteenSalaryPage(String agencyId,
                                                       String salaryMonth,
                                                       List<String> salaryColumns);

    /**
     * 十三月工资：查询十三月工资数量
     * @param agencyId
     * @return
     */
    Map<String, Object> selectThirteenSalarySum(String agencyId,
                                                      List<String> salaryColumns);

    /**
     * 十三月工资：重新生成
     * @param agencyId
     */
    void physicalDeleteThirteenMonthSalary(String agencyId);

    /**
     * 十三月工资：批量修改现有十三月工资
     * @param list
     */
    void batchUpdateThirteenMonthSalary(String[] columns, List<Object[]> list);

    /**
     * 工资表增加人
     * @param params
     */
    void addPersonSalary(Object[] params);

    /**
     * 工资表删除人
     * @param personId
     */
    void deletePersonSalary(String personId);

    /**
     * 工资表修改人
     * @param personId
     */
    void  updatePersonSalary(String personId,String agencyId);

    /**
     * 根据用户和机构id修改十三月工资
     * @param personId
     * @param agencyId
     * @param thirteenSalary
     */
    void updateThirteenSalaryByPersonAndAgencyId(String personId, String agencyId, Double thirteenSalary);

    /**
     * 根据人员和机构id清空十三月工资
     * @param personId
     * @param agencyId
     */
    void clearThirteenSalaryByPersonAndAgencyId(String personId, String agencyId);

    /**
     * 根据机构id清空十三月工资
     * @param agencyId
     */
    void clearThirteenSalaryByAgencyId(String agencyId);

    /**
     * 通过用户和机构id判断该用户是否有数据
     * @param personId
     * @param agencyId
     * @return
     */
    int selectCountByPersonAndAgencyId(String personId, String agencyId);
    /**
     *  字段清零
     * @param colum
     * @param agencyInfo
     */
    void  clearSalaryMonthEndByColum(String colum ,AgencyInfo agencyInfo);

    /**
     * 通过工资项修改应发实发,agencyInfo为null时修改所有数据
     * @param salaryBasedata
     * @param agencyInfo
     */

    void updateRealAndWages(SalaryBasedata salaryBasedata, AgencyInfo agencyInfo);

    /**
     * 通过单位id和personid修改
     * @param data
     * @throws NoSuchMethodException
     * @throws InvocationTargetException
     * @throws IllegalAccessException
     */
    void updateSalaryMonthEndByAgencyIdAndPersonId(SalaryMonthEnd data)throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;

    /**
     * 单位工资编报导入：批量修改工资数据
     * @param salaryMonthEndVOs
     * @return
     */
    void batchUpdateSalaryMonthEnd(List<SalaryMonthEndVO> salaryMonthEndVOs) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;


    /**
     * 单位工资编报导入：批量修改工资数据批次
     * @param salaryMonthEndVOs
     * @return
     */
    void batchUpdateSalaryMonthEndDouble(List<SalaryMonthEndVO> salaryMonthEndVOs) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;


    /**
     * 获取实发工资
     * @param agencyId
     * @return
     */
    Integer getPaidWagesCount(String agencyId, String  zeroAble);
    /**
     * 获取批次实发工资
     * @param agencyId
     * @return
     */
    Integer getPaidWagesCountDouble(String agencyId, String  zeroAble);

    /**
     * 查询当月工资与上月相比发生变动的人员id
     * @param agencyId
     * @return
     */
    List<String> selectDifferentPersonId(String agencyId);

    /**
     * 通过单位id执行公式修改实发应发与扣减合计
     * @param agencyId
     */
    void updateRealAndWagesAndSub(String agencyId,List<String> addlist,List<String> sublist);

    /**
     * 查询带人员工资类别的工资数据
     * @param province
     * @param agencyIds
     * @return
     */
    List<SalaryMonthEndVO> selectSalaryMonthEndWithSalaryType(String province, List<String> agencyIds);

    /**
     * 查询带人员工资类别的工资数据
     * @param province
     * @param agencyIds
     * @return
     */
    List<SalaryMonthEndVO> selectSalaryMonthEndSubmitWithSalaryType(String province, List<String> agencyIds);

    /**
     * 根据区划和人员id查询工资数据
     * @param mofDivCode
     * @param personIds
     * @return
     */
    List<SalaryMonthEndVO> querySalaryByPersonIdOrMofDivCode(String mofDivCode, List<String> personIds);

    /**
     * 获取报盘明细数据
     * @param mof_div_code
     * @param columnList
     * @return
     */
    List<Map<String, Object>> selectMXOffer(String mof_div_code, List<String> columnList);
    /**
     * 根据agencyid查询所有工资项
     * @param agencyId
     * @return
     */
    List<SalaryMonthEndVO> getSalaryMonthEndVOByPersonId(String agencyId);
    /**
     * 根据agencyid查询所有工资项
     * @param agencyId
     * @return
     */
    List<SalaryMonthEndVO> getSalaryMonthEndVOByPersonIdDouble(String agencyId);


    void batchSaveSalaryMonthEnd(List<SalaryMonthEndVO> salaryMonthEndVOList) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException;

    /**
     * 获取月初应发总合
     * @param agencyId
     * @return
     */
    Double selectSubmitReallyShouldSendSum(String agencyId, String shouldSend);


    String getZeroAble(String province);

    List<SalaryMonthEndVO> selectSalaryMonthEndSubmitWithSalaryTypes(String province, String agencyIds);

    List<SalaryMonthEndVO> selectSalaryMonthEndWithSalaryTypes(String province, String agencyIds);

    List<SalaryMonthEnd> getSalaryMonthEndByAgencyId(String agencyIds);

    SalaryMonthEnd getAgencyVerifyIsThirteen(String agencyIds,String province);

    AgencyVerify getAgencyVerifyBizKey(String agencyId);
}
